package org.bzjj.tool;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.bzjj.log.MyLog;

public class ChatMethod {

	/**
	 * 设置返回字符
	 * 
	 * @param content
	 *            返回的字符串
	 */
	public static void setResponse(HttpServletResponse response, String content) {
		PrintWriter out = null;
		try {
			response.setCharacterEncoding("UTF-8");
			out = response.getWriter();
		} catch (UnsupportedEncodingException e) {
			Logger logger = MyLog.getLog("ChatMethod");
			logger.error(e.getMessage());
		} catch (IOException e) {
			Logger logger = MyLog.getLog("ChatMethod");
			logger.error(e.getMessage());
		}
		if (out != null) {
			out.print(content);
		}
		out.flush();
		if (out != null) {
			out.close();
		}

	}
}
